import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        fit: StackFit.expand,
        children: [
          // 背景图片铺满屏幕
          Image.asset(
            'images/background.jpg',
            fit: BoxFit.cover,
          ),

          // // 居中显示的欢迎语
          // Positioned.fill(
          //   child: Align(
          //     alignment: Alignment.center,
          //     child: Container(
          //       padding: const EdgeInsets.all(20),
          //       child: const Center(
          //         child: Text(
          //           "欢迎使用忆衣APP",
          //           style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
          //           textAlign: TextAlign.center,
          //         ),
          //       ),
          //     ),
          //   ),
          // ),

          // 底部按钮
          Positioned(
            bottom: 0,
            left: 0,
            right: 0,
            child: Container(
              padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  ElevatedButton(
                    onPressed: () {
                      Navigator.pushNamed(context, "/login");
                    }, // 添加登录处理逻辑
                    style: ElevatedButton.styleFrom(
                      // 自定义按钮样式
                      padding: const EdgeInsets.symmetric(
                          vertical: 20, horizontal: 40), // 增加内边距使按钮更大
                      minimumSize: const Size(100, 50), // 设置按钮最小尺寸
                    ),
                    child: const Text(
                      "登录",
                      style: TextStyle(
                          fontSize: 24, color: Colors.red), // 可调整字体大小以匹配按钮尺寸
                    ),
                  ),
                  ElevatedButton(
                    onPressed: () {
                      Navigator.pushNamed(context, '/register');
                    }, // 添加注册处理逻辑
                    style: ElevatedButton.styleFrom(
                      padding: const EdgeInsets.symmetric(
                          vertical: 20, horizontal: 40),
                      minimumSize: const Size(100, 50),
                    ),
                    child: const Text(
                      "注册",
                      style: TextStyle(fontSize: 24, color: Colors.red),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}
